OS2API.TXT Copyright (c) 1996 xTech Ltd ---------------------------------------------------------------- Native XDS-x86 OS/2 Edition --------------------------- v2.17 (pre-release) OS/2 API support 1. Introduction --------------- This file contains the short description of XDS OS/2 API support usage in your Modula-2/Oberon-2 programs. This feature is not covered in the documentation yet, but it already exists in the pre-release version and we'd like it to be tested. 2. Requirements --------------- This distribution does not yet include the OS/2 API libraries, which you should have in order to access the API from your programs. These libraries are the part of the IBM Developer's Toolkit for OS/2, which is available on the Developers Connection CD-ROMs and along with some C compilers, for instance, IBM VisualAge C++ or Watcom. We've asked IBM for permission to incorporate these libraries into XDS package, but have no answer yet. 3. OS/2 API definition module - OS2.DEF --------------------------------------- The whole API is defined in a single Modula-2 definition module OS2.DEF, which resides in the DEF subdirectory of the distribution. It is very large (more than 1Mb) and its symbolic file would be very large too and would create the big time and memory overhead during compilation. Fortunately, the original C header files were built using conditional compilaion sections - you have to define a constant (like INCL_DOSPROCESS) before including the main OS2.H header file to select the appropriate section. This idea, as well as constant names, is preserved in XDS. Thus, to use an OS/2 API call in your program: A. Declare the correspondent INCL_xxx option in the PROJECT file. For example: -INCL_DOSPROCESS:+ B. Depending on whether your program is a text-mode or a Presentation Manager application, toggle the VIO or PM option ON in the PROJECT file: +PM C. Add the module OS2 to the import list of your program. You can use qualified or unqualified import: IMPORT OS2; (* qualified *) FROM OS2 IMPORT DosBeep; (* unqualified *) D. Now you can insert the required call: OS2.DosBeep(1000,100); (* qualified *) DosBeep(1000,100); (* unqualified *) NOTE 1: If you have to pass a procedure as a parameter to the API call (a window procedure, for example), you should specify the "SysCall" calling convention: PROCEDURE ["SysCall"] MyWindowProc ( hwnd : HWND; msg : LONGCARD; mp1 : MPARAM; mp2 : MPARAM ) : MRESULT; NOTE 2: If your application uses resources, you'll have to incorporate the binary resource file into the executable by hand. You may use the OS/2 resource compiler (RC.EXE): rc myapp.res myapp.exe This inconvenient approach will be changed in future releases. NOTE 3: You have to manually force recompilation of OS2.DEF file after you add or remove INCL_xxx options from your project. To achieve this, either remove the OS2.SYM file or use the =all submode when making your project. See also the Modula-2 sample PM application in SAMPLES\MAND subdirectory. [end of document]